this._capturedEventId = 0;
this._keyPressId = 0;
- source.connect('clicked', Lang.bind(this,
- function() {
- this.emit('dismissed');
- }));
-
source.connect('destroy', Lang.bind(this, this.destroy));
this.actor = new St.Table({ name: 'notification',
function (actor, event) {
if (!this._actionArea ||
!this._actionArea.contains(event.get_source()))
- this.source.clicked();
+ this.emit('clicked');
}));
// The first line should have the title, followed by the
},
notify: function(notification) {
- if (this.notification)
+ if (this.notification) {
+ this.notification.disconnect(this._notificationClickedId);
this.notification.disconnect(this._notificationDestroyedId);
+ }
this.notification = notification;
+ this._notificationClickedId = notification.connect('clicked', Lang.bind(this, this._notificationClicked));
this._notificationDestroyedId = notification.connect('destroy', Lang.bind(this,
function () {
if (this.notification == notification) {
this.notification = null;
this._notificationDestroyedId = 0;
+ this._notificationClickedId = 0;
}
}));
this.emit('notify', notification);
},
- clicked: function() {
- this.emit('clicked');
- },
-
destroy: function() {
this.emit('destroy');
},
if (this._iconBin.child)
this._iconBin.child.destroy();
this._iconBin.child = icon;
+ },
+
+ // Default implementation is to do nothing, but subclass can override
+ _notificationClicked: function(notification) {
}
};
Signals.addSignalMethods(Source.prototype);
let source = new Source(title, pid);
this._sources[pid] = source;
- source.connect('clicked', Lang.bind(this,
- function() {
- source.destroy();
- }));
source.connect('destroy', Lang.bind(this,
function() {
delete this._sources[pid];
if (notification == null) {
notification = new MessageTray.Notification(source, summary, body, { icon: iconActor });
ndata.notification = notification;
- notification.connect('dismissed', Lang.bind(this,
+ notification.connect('clicked', Lang.bind(this,
function(n) {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
}));
this.useNotificationIcon = false;
},
- clicked: function() {
+ _notificationClicked: function() {
this.openApp();
- MessageTray.Source.prototype.clicked.call(this);
+ this.destroy();
},
openApp: function() {
this.ICON_SIZE);
},
- clicked: function() {
+ _notificationClicked: function(notification) {
channelDispatcher.EnsureChannelRemote(this._accountPath,
{ 'org.freedesktop.Telepathy.Channel.ChannelType': Telepathy.CHANNEL_TEXT_NAME,
'org.freedesktop.Telepathy.Channel.TargetHandle': this._targetHandle,
global.get_current_time(),
'',
Lang.bind(this, this._gotChannelRequest));
-
- MessageTray.Source.prototype.clicked.call(this);
},
_gotChannelRequest: function (chanReqPath, ex) {
source = new Source(app, window);
this._sources[appId] = source;
Main.messageTray.add(source);
- source.connect('clicked', Lang.bind(this, function() { source.destroy(); }));
source.connect('destroy', Lang.bind(this, function() { delete this._sources[appId]; }));
}
return this._app.create_icon_texture(this.ICON_SIZE);
},
- clicked : function() {
+ _notificationClicked : function(notification) {
Main.activateWindow(this._window);
- MessageTray.Source.prototype.clicked.call(this);
+ this.destroy();
}
-
};